package com.me.servlet;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.AsyncContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/*@WebServlet(name="AsyncNumServlet", urlPatterns={"/asyncNum"},  
asyncSupported = true)  */
public class AsyncNumServlet extends HttpServlet {

	/**
	 * 
	 */
	
	private List<AsyncContext>  asyncs;  
	private static final long serialVersionUID = 1L;
	private Map mpa ;
	
    @Override  
    public void init() throws ServletException {  
        List<AsyncContext> attribute = (List<AsyncContext>) getServletContext()  
                                        .getAttribute("asyncs");
    }
    
    
    @Override  
    protected void doGet(HttpServletRequest request,  
                              HttpServletResponse response)  
                                     throws ServletException, IOException {  
        AsyncContext ctx = request.startAsync();  
        synchronized(asyncs) {  
            asyncs.add(ctx);  
        }  
    }       
}
